package com.qf.week1.day03;

import java.util.Scanner;

public class GradeDemo {
    public static void main(String[] args) {
        int grade;
        int max;
        int min;
        float avg;
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入成绩");
        grade = sc.nextInt();
        max = grade;
        min = grade;
        avg = grade;
        for(int i = 1;i<5;i++){
            System.out.println("请输入成绩");
            grade = sc.nextInt();
            avg = avg+grade;
            for(int j = 0;j<i;j++){
                if(max>grade||max==grade){
                    max = max;
                }else{
                    max = grade;
                }
                if(min<grade||min==grade){
                    min = min;
                }else{
                    min = grade;
                }
            }
            System.out.println("最大值是："+max);
            System.out.println("最小值是："+min);
            System.out.println("平均值是："+avg/(i+1));
        }
    }
}
